package Homework;

import java.io.*;
import java.util.Scanner;

public class HomeWork {
    public static void main(String[] args) throws IOException {

        PrintWriter pw1 = new PrintWriter("t1.txt");
        Scanner scan = new Scanner(System.in);
        while (true){
            System.out.println("请输入记事本：");
            String str = scan.next();
            if(str.equals("exit")){
                System.out.println("结束了");
                break;
            }
            pw1.write(str);
        }
        pw1.close();







/*
        PrintWriter pw = new PrintWriter("t9.txt");
        while (true){

            System.out.println("记事本，请输入：");
            Scanner scan = new Scanner(System.in);
            String str = scan.next();
           if(str.equals("exit")){
               System.out.println("程序已退出");
               break;
           }
            pw.println(str);
            pw.flush();
        }
        pw.close();
        System.out.println("记事本输入完毕！");
 */
//        FileInputStream  fis = new FileInputStream("t9.txt");
//        InputStreamReader isr = new InputStreamReader(fis);
//        BufferedReader br = new BufferedReader(isr);
//       String i;
//        while ((i=br.readLine())!=null){
//            System.out.println(i);
//        }
//        br.close();
//

/*
        try {
            String name = "";
            System.out.println(name.charAt(0));
        }catch (Exception e) {
            System.out.println("李信德大S马帅Bi");
        }finally {
            System.out.println("必须执行这个");
        }

//        String name = "张三";
//        int  age = 34;
//        String gender ="男";
//        Student1 jk = new Student1(name,age,gender);


        try{
            Student1 jk = new Student1();
            jk.setAge(2600);
            System.out.println("年纪为："+jk.getAge()+"岁");
        }catch (Exception e){
            System.out.println("年龄输入错误");
        }

 */



    }
}
